package com.tanhua.server.service;

import com.tanhua.server.exception.BusinessException;
import com.tanhua.server.interceptor.UserHolder;
import com.tanhua.dubbo.api.UserLocationApi;
import com.tanhua.model.vo.ErrorResult;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

/**
 * @author ck
 * @date 2021/11/17 19:23
 */


@Service
public class BaiduService {

    @DubboReference
    private UserLocationApi userLocationApi;

    //更新地理位置
    public void updateLocation(Double longitude, Double latitude, String address) {
        Boolean flag = userLocationApi.updateaLocation(UserHolder.getUserId(),longitude,latitude,address);
        if (!flag){
            throw new BusinessException(ErrorResult.error());
        }
    }
}
